<?php
##############################################
#
#   菜单配置
# @ Time：2016-12-9 - 上午12:00:09
# @ Author ：JiangYongWei <1085562810@qq.com>
# @ Encoding ：UTF-8 language ：PHP
#
##############################################

namespace Admin\Model;
class UserGroupModel extends AdminBaseModel{
	/* 用户组表  */
	protected $tableName = 'auth_group';	
	
	public function __construct($tableName=''){
		//初始化数据库对象
		if(!empty($tableName)){
			$this -> tableName = $tableName;
		}	
		parent::__construct($this -> tableName);
	}
	
	/**
	 * 获取用户组
	 * @return array
	 */
	public function getUserGroup(){
		return $this -> select();
	}

	/**
	 * 添加用户组
	 * @param array $data
	 */
	public function addUserGroup($data){
		return $this -> add($data);
	}
	
	/**
	 * 删除用户组
	 * @param int $id
	 */
	public function deleteUserGroup($id){
		return $this -> where("id = $id") -> delete();	
	}
	
	/**
	 * 修改用户组
	 * @param array $data
	 */
	public function editUserGroup($data){
		return $this -> where("id = {$data['id']}") -> setField('title', $data['title']);
	}
	
	public function getUserGroupData($id){
		return $this -> where("id = $id") -> find();
	}
}